package zhang.lao.console.controller.front;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import zhang.lao.build.mybatis.jdbc.auto.model.BoContactUs;
import zhang.lao.build.tool.UUIDTool;
import zhang.lao.dao.base.BoContactUsDao;
import zhang.lao.pojo.console.resp.HttpResult;
import zhang.lao.pojo.console.resp.HttpResultUtil;

import javax.annotation.Resource;
import java.util.Date;

/**
 * Created by Administrator on 2018/5/8.
 */
@Controller
public class IndexController
{

    @Resource
    private BoContactUsDao boContactUsDao;
    @RequestMapping("/")
    public String index(){
        return "front/index";
    }

    @RequestMapping("/{page}")
    public String index(@PathVariable String page){
        return "front/"+page;
    }


    @RequestMapping(value = "/contact/send",method = {RequestMethod.POST})
    public String contactSend(BoContactUs boContactUs){
        boContactUs.setId(UUIDTool.getUUID());
        boContactUs.setLinkTime(new Date());
        boContactUs.setLinkState(0);
        boContactUsDao.insertSelective(boContactUs);
        return "redirect:/contact";
    }
}
